﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace MobiShop.Models
{
    public class ManufactureModels
    {
        //---Đạt
        // lấy danh sách menu
        public static List<Manufacture> getManufactureList()
        {
            MobishopEntities context = new MobishopEntities();
            var query = from category in context.ManufactureList
                        where category.visible==true
                        select category;
            return query.ToList<Manufacture>();
        }

        public static Manufacture GetById(int id)
        {
            MobishopEntities context = new MobishopEntities();
            var query = from manufacture in context.ManufactureList
                        where manufacture.id == id && manufacture.visible == true
                        select manufacture;
            if (query.Count() == 1) return query.First();
            else return null;
        }
    }
}